package com.example.leakcanarytest;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;

import com.squareup.leakcanary.RefWatcher;

public class LeakCanaryActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_leakcanary);

        //获取单例对象，退出Activity即可模拟出内存泄露
        TestManager.getInstance(this);
        new Thread(new Runnable() {
            @Override
            public void run() {
                for (; ; ) {

                }
            }
        }).start();

    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        RefWatcher refWatcher = MyApplication.getRefWatcher(this);
        refWatcher.watch(this);
    }
}
